package com.lldpet.spring.cloud.demo.config.client.controller;

import com.lldpet.spring.cloud.demo.config.client.service.AutowiredTest;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @desc：hello controller
 * @author: guanliang.xue
 * @date: 2021/5/6 15:51
 * @version:
 * @since:
 */
@RestController
@RefreshScope
@RequestMapping("hello")
public class HelloController {

    @Value("${config.client.hello:hello}")
    private String hello;

    @Resource
    private AutowiredTest autowiredTest;

    @GetMapping("hello")
    public String hello(){
        return this.hello;
    }

    @GetMapping("custom")
    public String getCustomer(){
        autowiredTest.getCustomUserMap().entrySet()
                .stream()
                .forEach(entry -> System.out.println(entry.toString()));
        return null;
    }
}
